#include <ros.h>
#include "std_msgs/Bool.h"

int LED = 13;

ros::NodeHandle nh;

void messageCb(const std_msgs::Bool led_msg) {
  if(led_msg.data) {
    digitalWrite(LED, HIGH);
  }
  else{
    digitalWrite(LED, LOW);
  }
}

ros::Subscriber<std_msgs::Bool> sub("led_ctrl", &messageCb);

void setup() {
  // put your setup code here, to run once:
  pinMode(LED, OUTPUT);
  nh.initNode();
  nh.subscribe(sub);
}

void loop() {
  // put your main code here, to run repeatedly:
  nh.spinOnce();
  delay(1);
}
